package cn.task.part2.part3.utils;

import cn.task.part2.part3.dao.Customer;
import cn.task.part2.part3.dao.PreferredCustomer;

public class Entry {
	
	private static Customer customer;
	
	private static PreferredCustomer preferredCustomer;
	
	
	public static void create(Customer c) {
		customer = new Customer(c.getName(), c.getAddress(), c.getTelephone(), c.getNumber(), c.getIsMail());
		display(customer);
	}
	
	public static void createPreferred(PreferredCustomer pc) {
		preferredCustomer = new PreferredCustomer(
										pc.getName(), pc.getAddress(), pc.getTelephone(), 
										pc.getNumber(), pc.getIsMail(),pc.getSpends());
		if(pc.getSpends()>=500&&pc.getSpends()<1000) {
			preferredCustomer.setDiscount(5);
		}else if(pc.getSpends()>=1000&&pc.getSpends()<1500) {
			preferredCustomer.setDiscount(6);
		}else if(pc.getSpends()>=1500&&pc.getSpends()<2000) {
			preferredCustomer.setDiscount(7);
		}else {
			preferredCustomer.setDiscount(10);
		}
		display(preferredCustomer);
	}

	private static void display(Customer customer) {
		System.out.println("Customer "+"name: "+customer.getName()
								+" address: "+customer.getAddress()
								+" telephone: "+customer.getTelephone()
								+" number: "+customer.getNumber()
								+" IsMail: "+customer.getIsMail());
		
	}
	
	private static void display(PreferredCustomer customer) {
		System.out.println("Customer "+"name: "+customer.getName()
								+" address: "+customer.getAddress()
								+" telephone: "+customer.getTelephone()
								+" number: "+customer.getNumber()
								+" IsMail: "+customer.getIsMail()
								+" spends: "+customer.getSpends()
								+" discount: "+customer.getDiscount());
		
	}

}
